package com.dm.shop.config;

import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @version 1.0
 * @author: Saiya Wang
 * @desc:mybatisplus的删除、分页配置
 * @date: 2021/7/22 16:43
 */
//启用事务管理 代理目标类
@EnableTransactionManagement(proxyTargetClass = true)
@Configuration
public class MybatisPlusConfig {

    /**
     * 分页插件
     * @return
     */
    @Bean
    public PaginationInterceptor paginationInterceptor()
    {
        return new PaginationInterceptor();
    }

    /**
     * 逻辑删除的插件
     * @return
     */
    @Bean
    public ISqlInjector sqlInjector()
    {
        return new LogicSqlInjector();
    }
}
